(function($){
	$.fn.iScrollPic = function(Objs){
		var defaults = {
			box_w:120,
			Interval:4000,
			bun:true,
			autoplay:true
		}
		var Objs = $.extend(defaults,Objs);
		this.each(function(){
			var that=$(this);
			var star=0,pic_w=Objs.box_w,speed=1,jqul,jqli,count,pics_w,pics_ws,picsHTML,time;
			jqul=$(that).find("ul");
			jqli=$(jqul).find("li");
			count=$(jqli).length;
			//picsHTML=$(jqul).html();
			//$(jqul).append(picsHTML);
			pics_w=pic_w*count;
			$(jqul).css({"width":pics_w+"px"});
			function bric(){
			star++;
			if(star>=count) {star=0;};
			if(star<0) {star=count-1;};
			speed=star*-pic_w;
			$(jqul).stop(true,false).animate({left:speed+"px"});
			}
			
			function autoplay(){time=setInterval(bric,Objs.Interval);}
			if(Objs.autoplay==true){autoplay();}
			if(Objs.bun==true){
			var bun_html="<a class='bun lbun' href='#'></a><a class='bun rbun' href='#'></a>";
			$(that).prepend(bun_html);
			$(that).find(".lbun").bind({
				click:function(){
					clearInterval(time);
					bric();
					if(Objs.autoplay==true){autoplay();}
					return false;
					}});
			$(that).find(".rbun").bind({
				click:function(){
					clearInterval(time);
					star=star-2;
					bric();
					if(Objs.autoplay==true){autoplay();}
					return false;
					}});
				}
			
		});
	};
})(jQuery);